package base.day12;

import java.util.Scanner;

public class CharAt {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入：");
        String s=sc.nextLine();
        for (int i = 0; i < s.length(); i++) {
            char ch=s.charAt(i);
            System.out.println(ch);
        }
        System.out.println("---------------------------");
        //将字符拆分为数组遍历
        char[] charArray = s.toCharArray();
        for (int i = 0; i < charArray.length; i++) {
            System.out.println(charArray[i]);
        }
    }

}
